package com.fortune.cat;

import com.fortune.cat.filter.factory.AbstractCustomizeGatewayFilterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @author zhaozeyang
 * @date 2019/4/18 19:25
 * @description
 */
@Component
public class TestGroovyFilter2 extends AbstractCustomizeGatewayFilterFactory<TestGroovyFilter2.Config> {

    private Logger log=LoggerFactory.getLogger(TestGroovyFilter2.class);

    TestGroovyFilter2() {
        super(Config.class);
    }

    @Override
    protected Mono<Void> doApply(Config config, ServerWebExchange exchange, GatewayFilterChain chain) {
        log.info("it my TestGroovyFilter");
        return chain.filter(exchange);
    }

    @Override
    protected int doGetOrder() {
        return 0;
    }

    @Override
    protected boolean skipPresent(Config config, ServerWebExchange exchange) {
        return false;
    }

    static class Config{

    }

}
